
package com.hf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hf.entity.Users;
import com.hf.entity.UsersParam;
import com.hf.mapper.UsersMapper;
import com.hf.service.IUsersService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author eight
 * @since 2021-06-06
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, Users> implements IUsersService {
	@Autowired
	UsersMapper usersMapper;

	@Override
	public IPage<Users> getList(UsersParam u) {

		Page<Users> p = new Page<>(u.getPage(), u.getLimit());
		QueryWrapper<Users> q = new QueryWrapper<>();
		if (u.getIsLockOut() != null && !u.getIsLockOut().equals("")) {

			q.eq("is_lock_out", u.getIsLockOut());
		}
		if (u.getLoginName() != null && !u.getLoginName().equals("")) {
			q.like("login_name", u.getLoginName());
		}
		q.orderByDesc("id");
		Page<Users> selectPage = usersMapper.selectPage(p, q);

		return selectPage;
	}

	@Override
	public Users userLogin(String loginName) {
		// TODO Auto-generated method stub

		return usersMapper.userLogin(loginName);
	}

	@Override
	public Users getPasswordNum(String loginName, String password) {
		// TODO Auto-generated method stub
		return usersMapper.getPasswordNum(loginName, password);
	}

	@Override
	public boolean updatepsdWrongNum(String loginName) {
		// TODO Auto-generated method stub
		return usersMapper.updatepsdWrongNum(loginName);
	}

	@Override
	public boolean updatelockNum(String loginName) {

		return usersMapper.updatelockNum(loginName);
	}

	@Override
	public boolean setLock(Integer id) {
		// TODO Auto-generated method stub
		return usersMapper.setLock(id);
	}

	@Override
	public boolean setUnLock(Integer id) {
		// TODO Auto-generated method stub
		return usersMapper.setUnLock(id);
	}

	@Override
	public boolean updateLastLoginTime(Integer id, String lastLoginTime) {
		// TODO Auto-generated method stub

		return usersMapper.updateLastLoginTime(id, lastLoginTime);
	}

	@Override
	public boolean setLockTime(String lockTime, Integer id) {
		// TODO Auto-generated method stub

		return usersMapper.setLockTime(lockTime, id);
	}

	@Override
	public List<Users> getziZunShi(UsersParam userParam) {
		// TODO Auto-generated method stub
		return usersMapper.getziZunShi(userParam);
	}

	@Override
	public Users getUserByUserId(Integer userId) {
		// TODO Auto-generated method stub
		return usersMapper.getUserByUserId(userId);
	}

	@Override
	public boolean updateIsQianDao(Integer userId) {
		// TODO Auto-generated method stub
		return usersMapper.updateIsQianDao(userId);
	}

	@Override
	public boolean updateIsQianTui(Integer userId) {
		// TODO Auto-generated method stub
		return usersMapper.updateIsQianTui(userId);
	}

	@Override
	public List<Users> getQianziZunShi(UsersParam userParam) {
		// TODO Auto-generated method stub
		return usersMapper.getQianziZunShi(userParam);
	}
}
